package si.dejan.picflip
{
	import org.puremvc.as3.interfaces.IFacade;
	import org.puremvc.as3.patterns.facade.Facade;

	import si.dejan.picflip.controller.commands.Startup;
	import si.dejan.picflip.controller.commands.Update;

	public class ApplicationFacade extends Facade implements IFacade
	{
		public static const IMAGE_DOUBLE_CLICK:String = "imageDoubleClick";
		public static const IMAGE_CLICK:String = "imageClick";

		public static const NEXT_SET:String = "imagesNext";
		public static const PREV_SET:String = "imagesPrev";

		public static const STARTUP:String = "startup";
		public static const CHECK_UPDATE:String = "checkupate";

		public static  function getInstance():ApplicationFacade
		{
			if(!instance)
				instance = new ApplicationFacade();

			return instance as ApplicationFacade;
		}

		override protected function initializeController():void
		{
			super.initializeController();

			registerCommand(STARTUP, Startup);
			registerCommand(CHECK_UPDATE, Update);
		}

		public function startup(app:main):void
		{
			sendNotification(STARTUP, app);
			sendNotification(CHECK_UPDATE);
		}
	}
}